<template>
	<view class="center">
		<view class="header" style="color: #000000;" @tap="goBack(id)">
			<view class="arrow" style="padding-left: 10rpx;">
				<text class="cuIcon-back" style="color: #000;"></text>
			</view>
			<view class="title" style="color: #000;">
				提现
			</view>
		</view>
		<view class="mone-text">
			<view class="mb10" style="font-weight: 300;">
				可提现金额（元）
			</view>
			<text class=" fs56">
				{{money}}
			</text>
			<!-- <view class="query">
				<text class="cuIcon-pay" style="margin-right: 10rpx;"></text>
				提现
			</view> -->
		</view>
		<!-- <view class="flex box-top">
			<block v-for="(item,index) in list" :key="index">
				<view class="" style="margin-right: 60rpx;">
					{{item.name}}
				</view>
			</block>
		</view> -->
		<view class="flex box-top">
			<view class="nav flex  justify-between padding-lr-xl   f30 text-black">
				<text class=" flex flex-direction  align-start a" @click="flg(0)"
					:class="sts == 0 ? 'style' : ''">收益明细</text>
				<text class=" flex flex-direction a align-end" @click="flg(1)"
					:class="sts == 1 ? 'style' : ''">提现记录</text>
			</view>
		</view>
		<block v-if="sts == 0" v-for="(item,index) in listFrom" :key="index">
			<view class="paddin-bgc flex align-center justify-between u-border-bottom">
				<view class="flex lh40">
					<!-- <view class="">
						<image class="w88 h88 r44" :src="item.image" mode=""></image>
					</view>
					<view class="margin-left">
						{{item.name}}
						
					</view> -->
						{{item.createtime}}
					<!-- <view class="">
					</view> -->
				</view>
				<view class="">
					+{{item.money}}
				</view>
			</view>
		</block>

		<block v-if="sts == 1" v-for="(item,index) in listMoney" :key="index">
			<view class="paddin-bgc flex align-center justify-between u-border-bottom">
				<view class="lh40">
					提现
					<view class="">
						{{item.createtime}}
					</view>
				</view>
					 <!-- 状态：0=审核中，1=通过 -->
				<view class="">
					<text v-if="item.status == 0">审核中</text>
					<text v-if="item.status == 1">通过</text>
					<text style="margin-right: 10rpx;">- {{item.s_money}}</text>
				</view>
			</view>
		</block>




		<view class="foot_box"></view>
		<!-- 加载提示 -->
		<yy-loading text="加载中.." mask="true" click="true" ref="loading"></yy-loading>
		<!-- 信息提示-->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					name: '收益明细'
				}, {
					name: '提现记录'
				}],
				sts: 0,
				money: '',
				page: 1,
				listFrom: [],
				listMoney: [],
			};
		},
		onShow() {},
		onLoad(e) {
			this.userInfo()
			this.addListFrom()
			this.userlistFrom()
		},
		onReachBottom() {
			if (this.sts == 0) {
				this.page++
				this.userlistFrom()
			} else {
				this.page++
				this.addListFrom()
			}
		},
		methods: {
			clkOn() {
				this.z.load(this);
				setTimeout(() => {
					this.z.load(this, 0);
				}, 3000);
			},

			flg(e) {
				this.sts = e;
			},

			goToback(url) {
				uni.navigateTo({
					url,
				})
			},

			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},

			async userInfo() {
				const res = await this.$u.post('api/hotel/me?uid=' + uni.getStorageSync('uid'))
				this.money = res.data.money
			},
			
			// api/hotel.Index/add_mx
			async userlistFrom() {
				const res = await this.$u.post('api/hotel/find_mx', {
					user_id: uni.getStorageSync('uid'),
					page: this.page,
					pagesize: 10,
				})
				this.listFrom = [...this.listFrom, ...res.data]
				console.log(res)
			},

			// 提现明细   
			async addListFrom() {
				const res = await this.$u.post('api/hotel/find_tixian', {
					user_id: uni.getStorageSync('uid'),
					page: this.page,
					pagesize: 10,
				})
				this.listMoney = [...this.listMoney, ...res.data]
				console.log(res)
			},
		}
	};
</script>

<style lang="scss" scoped>
	.center {
		width: 100vw;
		// height: 100vh;
		overflow: scroll;

		.header {
			width: 100%;
			height: 200rpx;
			line-height: 150rpx;
			display: flex;
			align-items: center;
			// padding-left: 10rpx;
			padding-top: 30rpx;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #000;

			.arrow {
				position: relative;
				display: inline-block;
			}


			.title {
				margin: 0 auto;
			}
		}

		.query {
			position: absolute;
			right: 0;
			top: 100rpx;
			width: 184rpx;
			height: 60rpx;
			color: #FFFFFF;
			line-height: 60rpx;
			padding-left: 30rpx;
			border-radius: 30px 0px 0px 30px;
			background: rgba(190, 160, 110, 0.2);
		}

		.mone-text {
			position: relative;
			width: 96%;
			margin: 0 auto;
			color: #FFFFFF;
			padding: 0 22rpx;
			height: 275rpx;
			padding-top: 83rpx;
			font-weight: bold;
			font-family: PingFang SC;
			border-radius: 20rpx;
			background-color: #DDBB82;
		}

		.nav {
			.style::after {
				content: '';
				width: 100rpx;
				height: 6rpx;
				background: #fbb03b;
				border-radius: 3rpx;
				margin-top: 20rpx;
			}

			.a {

				width: 160rpx;
			}

			.style {
				font-weight: 600;
			}
		}

		.box-top {
			margin-top: 63rpx;
			padding-left: 23rpx;
		}

		.paddin-bgc {
			padding: 10rpx 20rpx;
		}



		.add {
			position: fixed;
			bottom: 200rpx;
			right: 40rpx;
			width: 90%;
			height: 100rpx;
			margin: 0 auto;
			text-align: center;
			line-height: 100rpx;
			border-radius: 50rpx;
			font-size: 26rpx;
			background: #525296;
			font-family: PingFang SC;
			color: #FFFFFF;
			opacity: 0.9;
		}

		// margin-top: -5rpx;
	}
</style>
